using System;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;

namespace EventBus
{
    public partial class EventBusImpl
    {
        public async UniTask<bool> BroadcastAsync(object sender, string eventName)
        {
            var broadcast  = GetOrCreateBroadcast(eventName);
            return await broadcast.BroadcastActionAsync<int, int, int, int, int, int, int, int>(eventName, 0, default, default, default, default,
                default, default, default, default);
        }

        public async UniTask<bool> BroadcastAsync<T1>(object sender, string eventName, T1 arg1)
        {
            var broadcast   = GetOrCreateBroadcast(eventName);
            return await broadcast .BroadcastActionAsync<T1, int, int, int, int, int, int, int>(eventName, 1, arg1, default, default, default,
                default, default, default, default);
        }

        public async UniTask<bool> BroadcastAsync<T1, T2>(object sender, string eventName, T1 arg1, T2 arg2)
        {
            var broadcast   = GetOrCreateBroadcast(eventName);
            return await broadcast .BroadcastActionAsync<T1, T2, int, int, int, int, int, int>(eventName, 2, arg1, arg2, default, default,
                default, default, default, default);
        }

        public async UniTask<bool> BroadcastAsync<T1, T2, T3>(object sender, string eventName, T1 arg1, T2 arg2, T3 arg3)
        {
            var broadcast   = GetOrCreateBroadcast(eventName);
            return await broadcast .BroadcastActionAsync<T1, T2, T3, int, int, int, int, int>(eventName, 3, arg1, arg2, arg3, default,
                default, default, default, default);
        }

        public async UniTask<bool> BroadcastAsync<T1, T2, T3, T4>(object sender, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
        {
            var broadcast   = GetOrCreateBroadcast(eventName);
            return await broadcast .BroadcastActionAsync<T1, T2, T3, T4, int, int, int, int>(eventName, 4, arg1, arg2, arg3, arg4,
                default, default, default, default);
        }

        public async UniTask<bool> BroadcastAsync<T1, T2, T3, T4, T5>(object sender, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
        {
            var broadcast   = GetOrCreateBroadcast(eventName);
            return await broadcast .BroadcastActionAsync<T1, T2, T3, T4, T5, int, int, int>(eventName, 5, arg1, arg2, arg3, arg4,
                arg5, default, default, default);
        }

        public async UniTask<bool> BroadcastAsync<T1, T2, T3, T4, T5, T6>(object sender, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
            T6 arg6)
        {
            var broadcast   = GetOrCreateBroadcast(eventName);
            return await broadcast .BroadcastActionAsync<T1, T2, T3, T4, T5, T6, int, int>(eventName, 6, arg1, arg2, arg3, arg4,
                arg5, arg6, default, default);
        }

        public async UniTask<bool> BroadcastAsync<T1, T2, T3, T4, T5, T6, T7>(object sender, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4,
            T5 arg5, T6 arg6, T7 arg7)
        {
            var broadcast   = GetOrCreateBroadcast(eventName);
            return await broadcast .BroadcastActionAsync<T1, T2, T3, T4, T5, T6, T7, int>(eventName, 7, arg1, arg2, arg3, arg4,
                arg5, arg6, arg7, default);
        }

        public async UniTask<bool> BroadcastAsync<T1, T2, T3, T4, T5, T6, T7, T8>(object sender, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4,
            T5 arg5, T6 arg6, T7 arg7, T8 arg8)
        {
            var broadcast   = GetOrCreateBroadcast(eventName);
            return await broadcast .BroadcastActionAsync<T1, T2, T3, T4, T5, T6, T7, T8>(eventName, 8, arg1, arg2, arg3, arg4,
                arg5, arg6, arg7, arg8);
        }
    }
}